#include <stdio.h>  
#include <string.h>  
  
struct nn {  
    int no;  
    int num;  
};  
  
typedef struct nn DATA;  
  
int number( char *, DATA []);  
  
int main( ) {  
    DATA b[100];  
    char sa[500];  
    int i, n;  
    gets( sa );  
    n = number( sa, b );  
    for ( i = 0; i < n; i++ )  
        printf("%d %d\n", b[i].num, b[i].no );  
    return 0;  
}  
  
int number( char *str, DATA a[] ) {  
    int cnt = 0, min = 2147483647, minp = -1;  
    str[strlen(str) + 1] = '\0';  
    while (*str != '\0') {  
        int bit = 0, x = 1;  
        char *p = str;  
        while (*p != ' ' && *p != '\0') {  
            bit++;  
            p++;  
        }  
        a[cnt].num = 0;  
        for (int i = bit - 1; i >= 0; i--, x *= 10)  
            a[cnt].num += x * (*(str + i) - '0');  
        cnt++;  
        str = p + 1;  
    }  
    int x[1005]; 
    for (int i = 0; i < cnt; i++) {  
        min = min > a[i].num ? a[i].num : min;  
        x[i] = 0;  
    }  
  
    for (int i = 0; i < cnt; i++) {  
        int minn = 2147483647;  
        int minnp = minp;  
        for (int j = 0; j < cnt; j++)  
            if (minn > a[j].num && a[j].num >= min && x[j] == 0) {  
                minnp = j;  
                minn = a[j].num;  
                a[j].no = i + 1;  
            }  
        x[minnp] = 1;  
        min = minn;  
    }  
    return cnt;  
}  